<%@ page import="java.util.List"%>
<%@ page import="com.riq.entity.Department"%>
<%@ page import="com.riq.ServletUtilities"%>
<%@ page import="com.riq.entity.Member"%>
<%@ page import="com.riq.entity.Metric"%>
<%@ page import="com.riq.entity.Location"%>
<%@ page import="com.riq.entity.Status"%>
<%@ page import="java.util.logging.Logger"%>
<%@ page import="java.io.IOException"%>

<%
    Cookie[] cookie = request.getCookies();
    Long deptId = Long.valueOf(ServletUtilities.getCookieValue(cookie, "cvDeptId", "99999"));
    Long timeStamp = System.currentTimeMillis();
    Metric lM = (Metric) request.getAttribute("lM");
%>

<!-- Copyright 2010 John L. Reilly

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.  -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<title>FirstResponder</title>

<!--Load the AJAX API-->
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">

  // Load the Visualization API and the piechart package.
  google.load('visualization', '1', {'packages':['barchart']});
  
  // Set a callback to run when the Google Visualization API is loaded.
  google.setOnLoadCallback(drawChart);
  
  // Callback that creates and populates a data table, 
  // instantiates the pie chart, passes in the data and
  // draws it.
  function drawChart() {

  // Create our data table.
    var data = new google.visualization.DataTable();
    data.addColumn('string', 'Task');
    data.addColumn('number', 'Alerts');
    data.addRows([
      ['False Alarm', 11],
      ['CO', 2],
      ['Fire', 2],
      ['Training', 2],
      ['Other', 7]
    ]);

    // Instantiate and draw our chart, passing in some options.
    var chart = new google.visualization.BarChart(document.getElementById('chart_div'));
    chart.draw(data, {width: 300, height: 240, is3D: false, legend: 'bottom'}
    colors, {red, green});
  }
</script>

<!--META-->
<meta http-equiv="content-type"  content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width" />

<!--STYLESHEET-->
<link rel="stylesheet" type="text/css" href="stylesheets/static.css" />

</head>
<body>

<!--FIXED HEADERS-->
<div class="headwrap">
<div class="hBlack">
<div class="headerLeftTop">FirstResponder</div>
<div class="headerRightTop">ver 0.9</div>
<div class="headerLeftBottom">Department: Display</div>
<div class="headerRightBottom">12:34 PM</div>
</div>
<div class="hGray">
  <a class="buttonGrayHdr" href="mainMenu.html">Main</a>
  <a class="buttonGrayHdr" href="commandMenu.html">Command</a>
  <a class="buttonGrayHdr gSelected" href="department?action=display">Admin</a>
</div>
<div class="headerMist"></div>
</div>

<div class="outwrap">
<div class="headerPlug"></div>

<!--BUTTONS-->
<div id="centeredButtons"><ul><li>

<a class="button blue narrow tall first" href="deptDisplay.jsp">
   Back</a>
</div>

<div class="sub black" style="margin-bottom: 10px">
<div class="row">LAST READING: TBD
</div>
</div>

<div class="row">Initialize Reading</div>
<div class="row right">
<a class="button blue small" href="metrics?action=initMetric">Go</a>
</div>

<div class="row">Get Results</div>
<div class="row right">
<a class="button blue small" href="metrics?action=report">Go</a>
</div>

<div class="row">Tracking: <%=lM.getmetrics().get(0).toString().substring(0, lM.getmetrics().get(0).toString().indexOf(".")) %></div>
<div class="row right">
<a class="button blue small" href="metrics?action=metric1">Go</a>
</div>

<div class="row">No Tracking: <%=lM.getmetrics().get(1).toString().substring(0, lM.getmetrics().get(1).toString().indexOf(".")) %></div>
<div class="row right">
<a class="button blue small" href="metrics?action=metric2">Go</a>
</div>

<div class="row">Fresh Update: <%=lM.getmetrics().get(2).toString().substring(0, lM.getmetrics().get(2).toString().indexOf(".")) %></div>
<div class="row right">
<a class="button blue small" href="metrics?action=metric3">Go</a>
</div>


<div class="row">Usage Last Call: <%=lM.getmetrics().get(3).toString().substring(0, lM.getmetrics().get(3).toString().indexOf(".")) %></div>
<div class="row right">
<a class="button blue small" href="metrics?action=metric4">Go</a>
</div>

<div class="sub black" style="margin-bottom: 10px">
<div class="row">DATA: </div>
</div>
<div class="row">Metric 1: <%=lM.getmetrics().get(0).toString()%></div>
<div class="row">Metric 2: <%=lM.getmetrics().get(1).toString()%></div>
<div class="row">Metric 3: <%=lM.getmetrics().get(2).toString()%></div>
<div class="row">Metric 4: <%=lM.getmetrics().get(3).toString()%></div>
</div>

<div id="chart_div"></div>

<!--BUTTONS-->
<div id="centeredButtons"><ul><li>
<a class="button blue narrow tall first last"
   href="department?action=display">
   Cancel</a></li><li>
<a class="button green narrow tall first last"
   href="#" onclick="javascript:document.forms[0].submit();return false;">
   Save</a>
</li></ul></div>

<div class="footer">jreilly  <%=deptId %></div>

<!--OUTLINE WRAPPER -->
</div> 

</body>
</html>